package megrez.common.util;

import java.io.PrintWriter;
import java.io.StringWriter;

import lombok.experimental.UtilityClass;

/**
 * 异常工具
 *  
 * @author Lucky Yang
 * @since 0.0.1
 */
@UtilityClass
public class ExceptionHelper {
    public String stacktraceToString(Throwable e) {
        if (e == null) {
            return null;
        }
        StringWriter stringWriter = new StringWriter();
        e.printStackTrace(new PrintWriter(stringWriter));
        return stringWriter.toString();
    }    
}
